<%--
  Created by IntelliJ IDEA.
  User: xiheng
  Date: 2021/7/5
  Time: 17:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
  <script type="text/javascript">
      $(function () {
          $("#uname").blur(function () {
              //1.获得value值
              var uname = $(this).val();
              //2.发送请求
              //方法1：
              /*$.ajax({
                 url:"/testuname",
                 data:"username="+uname,
                 type:"post",
                 dataType:"text",
                 success:function (rs) {
                     $("#rs").html(rs);
                 }
              });*/
              //方法2：get
              /*$.get("/testuname","username="+uname,function (rs) {
                  $("#rs").html(rs);
              })*/
              //方法2：post
              $.post("/testuname","username="+uname,function (rs) {
                  $("#rs").html(rs);
              });
          });
      })
  </script>
  <body>
      用户名：<input type="text" id="uname">
            <span id="rs"></span>
  </body>
</html>
